/*
 * util.h
 *
 *  Created on: 2012-9-14
 *      Author: Futbal
 */

#ifndef UTIL_H_
#define UTIL_H_

#include "base.h"

int GetMinOfTwo(int a, int b);

int GetMinOfThree(int a, int b, int c);

void PrintValues(int* a, int from, int to);

bool IsPostVisitSeqOfBSTree(int* a, int from, int to);

int GetMaxContinuousSum(int* a, int from, int to);

double GetMaxContinuousMul(double* a, int from, int to);

bool ExistSumEqualsN(int* a, int from, int to, int n);

int GetMaxMWithEqualSum(int* a, int from, int to);

int GetMaxContinuousSubSequence(int* a, int from, int to);

void PrintContinueSumEqualsN(int n);

void LeftOddRightEven(int* a, int from, int to);

void FindTwoNumsAppearsOnce(int* a, int from, int to, int& num1, int &num2);

int FindNthUglyNum(int n);

int GetTroubleMakerNum(int* a, int from, int to);

bool IsAscendingSequenceRecursively(int* a, int from, int to);

int* Generate(int a, int b, int N, int* Q);

#endif /* UTIL_H_ */
